import request from "@/request";
import type { responseType } from "./interface";

/**
 * 生成验证码
 * @returns
 */
export function generateImageCode(): Promise<responseType> {
  return request.get(`/generateImageCode`, {
    responseType: "arraybuffer",
  });
}

/**
 * loginUser
 * @param {string} acc
 * @param {string} pwd
 * @param {string} code
 * @returns
 */
export function loginUser(
  acc: string,
  pwd: string,
  code?: string
): Promise<responseType> {
  return request.post(`/loginUser?acc=${acc}&pwd=${pwd}&code=${code}`);
}
